package cn.bulibuqi.myblog.service;

import cn.bulibuqi.myblog.Util.MD5Utils;
import cn.bulibuqi.myblog.bean.User;

import cn.bulibuqi.myblog.dao.UserMapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author bulibuqi
 * @create 2021-12-15:26
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements UserService{



    @Override
    public User checkUser(String username, String password) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("username",username);
            //        加密后的密码
        queryWrapper.eq("password", MD5Utils.code(password));
        User user = baseMapper.selectOne(queryWrapper);
        return user;

    }




}
